/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-03-28
 * Time: 19:46
 */
public class Test {
    public static void main(String[] args) {

    }
    public static void main1(String[] args) {
        StringBuffer stringBuffer = new StringBuffer("hello");//被synchronized修饰，被修饰的代码块或方法只会有一个线程执行，保证线程安全
        stringBuffer.append("23");
        System.out.println(stringBuffer);

        StringBuilder stringBuilder = new StringBuilder("gu");
        stringBuilder.append("23");
        System.out.println(stringBuilder);

        String ret = stringBuffer.toString();

//        stringBuffer.insert(1,"abc");
//        System.out.println(stringBuffer);
//        stringBuffer.delete(1,3);
//        System.out.println(stringBuffer);//[1,3)
//        System.out.println(stringBuffer.reverse());
//        String str = stringBuffer.toString();
    }
}
